home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
basic
/
qlib54.zip
/
GRAPHICS.DOC
< prev
next >
Wrap
Text File
|
1992-04-25
|
62KB
|
1,490 lines
************************ QLIB GRAPHICS ***********************************
QLIB's graphics subroutines were written initially to provide Hercules
graphics functions without using QB's QBHERC.COM or MSHERC.COM memory-
resident drivers, and to provide added capabilities. Most of these
subroutines now work in additional graphics modes. QLIB automatically
configures itself for the graphics mode in use.
Locations on Graphics screens are defined by coordinate pairs such as (x,y).
X-coordinates are the horizontal dimensions of the screen, and Y-coordinates
are the vertical coordinates. X = 0 is the at the left edge of the screen,
and X = 719 is the right edge of a Hercules screen, while Y = 0 is the top
edge of the screen and Y = 347 is the bottom (Hercules). Thus, the
coordinate (719,0) is the upper right corner of a Hercules screen. Maximum
coordinate values for supported modes are shown on the next page.
You may also use your own coordinate system with QLIB graphics, similar
to using WINDOW with BASIC's graphics functions. See QWindow at the
end of this file.
QLIB graphics modes are:
Mode Maximum x Maximum y Colors Equipment
HGraph 719 347 2 Hercules
HGraph 719 347 16 Hercules InColor
SCREEN 1 319 199 4 CGA, EGA, MCGA, VGA
SCREEN 2 639 199 2 CGA, EGA, MCGA, VGA
SCREEN 3 (1) 719 347 2 Hercules
SCREEN 4 639 399 2 ATT (5)
SCREEN 7 319 199 16 EGA, VGA
SCREEN 8 639 199 16 EGA, VGA
SCREEN 9 639 349 16 EGA, VGA (2)
SCREEN 10 639 349 4 EGA, VGA (3)
SCREEN 11 639 479 2 MCGA, VGA
SCREEN 12 639 479 16 VGA
SCREEN 13 319 199 256 MCGA, VGA
VESA6A 799 599 16 (4)
XMode16 up to 799 up to 599 16 Super EGA/VGA
Super13 319 399 256 VGA
Super13a 359 479 256 VGA
SVGA16 up to 1024 up to 768 16 Super VGA
SVGA256 up to 1024 up to 768 256 Super VGA
(1) Requires MSHERC.COM or QBHERC.COM
(2) EGA with 128k or more memory
(3) monochrome monitor only
(4) VESA6A is supported by many Super VGA cards with multi-frequency
monitors. See ScreenMode.
(5) untested mode. Your feedback, please!
QLIB's 16-color graphics subroutines were developed with a maximum of
flexibility, so that extended graphics modes could be accomodated with
ease. If you are using an extended EGA or VGA card, QLIB's graphics
subroutines can be used at resolutions of up to 800 x 600 in 16 colors.
See XMode16 and ScreenMode.
If you have licenced QLIB's assembly-language source code, you may
want to re-assemble some of the graphics subroutines if you don't need
or want to support all QLIB graphics modes. QLIB source code has several
pre-defined conditional assembly directives which you may use to eliminate
unnessesary code:
NOCGA eliminates code for SCREEN 1 and SCREEN 2
NOINCOLOR eliminates code for the Hercules InColor card
(InColor equipment will work with Hercules monochrome
code in 2 colors)
NOHERC eliminates code for Hercules monochrome and InColor
NOVGA256 eliminates code for the three 256-color modes
NOMCGA eliminates SCREEN 11 code
for example, to use only EGA/VGA 16-color code, re-assemble
DRAWLINE.ASM like this:
C:\MASM>masm /dnoherc /dnocga /dnovga256 /dnomcga drawline;
this will reduce the size of drawline.obj significantly and will
speed its operation somewhat.
The style% parameter used in many QLIB Graphics subroutines follows these
general rules:
style% = 0 XORs the text/pixel/line/whatever with the pre-existing
screen: if a pixel (x,y) is XORed to the screen, the pixel
will be turned on if previously off, or will be turned off
if previously on;
style% = 1 is normal; lines are drawn, pixels are turned on, text is
foreground-on-background, and the previous screen content
is ignored or obliterated;
style% = 2 similar to style% 1, but foreground color only is updated
style% = 3 ORs the line or block with the existing screen; this means
that the new stuff is added to the old.
style% = 4 ANDs a block (or fillbox) with the existing screen; within
the block's limits, only those pixels where both the
previous screen and the pattern in the block have ON pixels
will there be a resulting ON pixel;
style% = -3 similar to style% 3, but reverses the foreground and
background before combining it with the screen
style% = -2 similar to style% 2, but reverses the foreground and
background before combining it with the screen
style% = -1 like style% 1, but uses background color. In monochrome
modes, pixels are erased, text is black with a bright
background.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: BitBlockSave(seg%, x0%, y0%, x1%, y1%)
Subroutine: BitBlockRestore(seg%, x%, y%, style%)
object files: bitblock.obj (q$graph.obj)
Function: bytes% = BitBlockBytes(x0%, y0%, x1%, y1%)
object files: bbbytes.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
SCREEN 1,2,3,7,8,12,13
SCREEN 9,10 (requires 128k+ EGA memory)
VESA6A, XMode16, Super13, Super13a
BitBlockSave copies a section of the graphics screen to system memory
in order to copy the block back to the screen later with BitBlockRestore.
BitBlockBytes returns the number of bytes of memory required store
the entire pixel block. Bytes% = 0 if the block is too big. After
calculating the bytes required, you may use AllocMem(bytes) to
allocate the memory space required. See AllocMem in DATA.DOC.
Note that bit block memory requirements can be large; the huge model
library QLIBH.LIB is required for large bitblocks in 16-color modes.
style% values supported by BitBlockRestore are:
SCREEN 13, super13, super13a:
1 = replace existing screen area with bit block
HGraph (InColor):
4 = AND the bit block with the existing screen
3 = OR the bit block with the existing screen
1,2 = replace existing screen area with bit block
0 = XOR the bit block with the existing image
-1,-2 = replace existing screen area with inverse bit block
16-color EGA/VGA-type modes and SCREEN 10:
same as InColor, plus:
-3 = OR the inverse bit block with the existing screen
-4 = AND the inverse bit block with the existing screen
SCREEN 1, 2, 3, 11, and HGraph (mono):
2 = combine non-zero pixels in the bit block with the
pre-existing image
1 = replace the existing screen image with un-altered
bit block
0 = XOR the bit block with the existing image
-1 = replace existing screen image with inverse bit block
-2 = combine non-zero pixel in the inverse bit block with
the previous screen image
See example on next page.
BIT BLOCK EXAMPLE:
REM This example calculates the array size required,
REM dimensions the array, saves a portion of the screen and
REM restores it later.
REM $INCLUDE: 'qlib.bi'
REM start in the desired graphics mode
.
.
.
x0 = 100: y0 = 0: x1 = 400: y1 = 347
bytes% = BitBlockBytes(x0%, y0%, x1%, y1%)
REM Note that BitBlockBytes returns a LONG integer when
REM assembled with the .MODEL HUGE directive
bbseg% = AllocMem(bytes%)
CALL BitBlockSave(bbseg%, x0%, y0%, x1%, y1%)
.
.
.
REM now we'll copy the block back to the screen
CALL BitBlockRestore(bbseg%, x2%, y2%, style%)
REM x2% and y2% may be any coordinates on the screen
REM also release the memory block
CALL FreeMem(bbseg%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: BitPlaneSave(seg%, x0%, y0%, x1%, y1%, plane%)
Subroutine: BitPlaneRestore(seg%, x0%, y0%, style%, plane%)
object files: bitblock.obj (q$graph.obj)
Function: bytes% = BitPlaneBytes(x0%, y0%, x1%, y1%)
object files: bbbytes.obj (q$graph.obj)
Modes supported: HGraph (InColor)
SCREEN 7,8,12
SCREEN 9 (requires 128k+ EGA memory)
VESA6A, XMode16
SCREEN 10 (planes 0 and 2)
BitPlaneSave subroutines copy a section of the graphics screen to a
memory buffer in order to copy that block back to the screen with
BitPlaneRestore. This is similar to the BitBlockSave/BitBlockRestore
subroutines, except that BitPlane subroutines copy to or from only one
of the four "planes" of memory in 16-color modes. This is handy when
the area you want to copy is too big to fit in one array, or when you
want to move or modify only one plane at a time. The exact color
represented by each plane is determined by PALETTE or COLOR statements.
BitPlaneBytes calculates the number of bytes of memory required to save
the desired portion of the plane. All style% values work with
BitPlaneRestore. You may use AllocMem(bytes%) to allocate memory
space for the bit plane.
Example:
REM $INCLUDE: 'qlib.bi'
REM calculate the array size required, allocate the memory,
REM save a portion of one plane of the screen and restores it later.
REM note that valid plane numbers are 0 - 3
REM First I need to establish graphics mode
CALL Xmode16(xmode%, maxX%, maxY%)
.
.
x0 = 100: y0 = 0: x1 = 400: y1 = 347
bytes% = BitPlaneBytes(x0%, y0%, x1%, y1%)
seg% = AllocMem(bytes%): plane% = 0
CALL BitPlaneSave(seg%, x0%, y0%, x1%, y1%, plane%)
.
.
REM now we'll copy the plane back to the screen
CALL BitPlaneRestore(seg%, x2%, y2%, style%, plane%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: ClearView
object files: drawline.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
ClearView erases everything within the active viewport. In
color modes, the background color set by GraphColor is used. Use
SetView to establish the active viewport.
Example:
CALL ClearView
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: DrawBox(x0%, y0%, x1%. y1%, style%)
object file: drawline.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
DrawBox draws a box with corners at (x0%, y0%), (x0%, y1%),
(x1%, y0%), (x1%, y1%). Legal style% parameters are -1, 0, and 1.
If any part of the box lies outside the active graphics viewport,
that part of the box will not be drawn. See also LinePattern.
Example:
CALL HGraph
x0% = 10: y0% = 10: x1% = 79: y1% = 38: style% = 0
CALL DrawBox(x0%, y0%, x1%, y1%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: DrawCircle(xc%, yc%, Xradius%, style%)
Subroutine: CircleAspect(numerator%, denominator%)
object files: drawcirc.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
DrawCircle draws a circle on a graphics screen centered at xc%, yc%,
with x-radius Xradius%. The circle's aspect ratio may be changed with
CircleAspect. Legal style% parameters are -1 and 1 with Hercules and
SCREEN 2. In color modes, style% parameters 2, -2, 3 and -3 are also
supported. Only the part of the circle which lies within the viewport
defined by SetView will be drawn.
CircleAspect changes the aspect ratio of the circle; using CircleAspect,
you can make the circle look like a flattened ellipse or a tall ellipse.
CircleAspect changes the Y-dimension of the circle; the X-dimension is
controlled with Xradius%. QLIB's default is an aspect ratio of 1:1 in
most graphics modes. SCREEN 12 and XMode16 circles may not have a 1:1
aspect ratio. CAUTION: extreme aspect ratios are not supported by
DrawCircle. With numerator% = 1, a maximum usable denominator% is 5,
or else a "divide by zero" error will occur. With denominator% = 1,
a high numerator will cause unpredictable results.
Example:
CALL DrawCircle(xc%, yc%, Xradius%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: DrawLine(x0%, y0%, x1%, y1%, style%)
object files: drawline.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
DrawLine draws a line from x0%, y0% to x1%, y1%. Legal style
parameters are -2, -1, 0, 1 and 2. See also LinePattern.
Example:
x0% = 0: y0% = 0: x1% = 719: y1% = 348: style% = -1
CALL DrawLine(x0%, y0%, x1%, y1%, style%)
REM this erases a diagonal line across the screen
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: FillArea(x%, y%, reserved%)
object files: drawline.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
FillArea fills irregularly-shaped areas enclosed by solid lines.
FillArea works best with SIMPLE areas; holes in the area or areas with
"inside" corners dividing horizontal lines may not be filled properly.
Further development is planned, but FillArea in its present form is
useful in many circumstances. FillArea works by starting at the seed
pixel (x%, y%) and looking left and right for non-black region boundaries,
then filling horizontal lines between the boundaries. FillArea works
upward until the top of the area has been reached, then returns to the
seed pixel and works downward. Reserved% is reserved for QLIB's style%
parameter. FillArea presently assumes style% = 1.
Example:
CALL HGraph
.
.
.
CALL GraphColor(attr%) ' for color modes
CALL FillPattern(pattern$) ' optional fill pattern
CALL FillArea(x%, y%, reserved%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: FillBox(x0%, y0%, x1%. y1%, style%)
object files: drawline.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
Similar to DrawBox, FillBox uses the same coordinates and style
variable, but fills the box instead of drawing the sides. If
style% = 1 or 2, an optional pattern may be used to fill the box
(except SCREEN 1). See FillPattern. NOTE: at the present stage of
development, 16-color modes do not support style% = 1 with a pattern.
Example:
CALL HGraph
x0% = 10: y0% = 10: x1% = 79: y1% = 38: style% = 0
CALL FillBox(x0%, y0%, x1%, y1%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: FillPattern(pattern$)
object files: fpattern.obj (drawline.obj, q$graph.obj)
Modes supported: HGraph (mono annd InColor)
VESA6A, XMode16
SCREEN 2,3,7,8,9,10,11,12
FillPattern defines an optional pattern used by FillBox if
style% >= 1, or by FillArea (which assumes style% = 1). The bit
patterns in the first 8 characters of pattern$ are used to modify the
fill in the box or area. FillPattern must be called before each call
to FillBox or FillArea. See Examples. FillBox will replace box borders.
If you want the box to have a solid outline, call DrawBox with style% = 1
after using FillBox with a pattern. Using style% = 1, the pattern will
completely replace whatever was in the box. 16-color modes use
style% = 2. BIT2INT in DATA.DOC is useful for establishing patterns.
Sample patterns, and what they produce:
pattern$ = CHR$(255) + STRING$(5,32) ' produces a pattern of squares
pattern$ = STRING$(8,32) ' produces vertical lines
pattern$ = CHR$(255) + STRING$(5,0) ' produces horizontal lines
pattern$ = STRING$(8,0): k% = 1
FOR i% = 1 TO 8
MID$(pattern$, i%) = CHR$(k%)
CALL ShiftINT(k%, 1)
NEXT i% ' produces diagonal lines, from
' upper right to lower left
pattern$ = STRING$(8,0):k% = 128
FOR i% = 1 TO 8
MID$(pattern$, i%) = CHR$(k%)
CALL ShiftINT(k%, -1)
NEXT i% ' produces diagonal lines, from
' upper left to lower right
Example:
x0% = 10: y0% = 10: x1% = 79: y1% = 38: style% = 1
pattern$ = CHR$(255) + STRING$(5,32) ' pattern for squares
CALL FillPattern(pattern$)
CALL FillBox(x0%, y0%, x1%, y1%, style%) ' fill box with pattern
CALL DrawBox(x0%, y0%, x1%, y1%, style%) ' draw solid box outline
CALL FillArea(x%, y%, reserved%) ' no pattern used
' because FillPattern
' was not called before
' FillArea
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GCopy(frompage%, topage%, oops%)
object files: gcopy.obj (q$graph.obj, gpage.obj)
Modes supported: HGraph (mono and InColor)
Super13
SCREEN 3,7,8,9,10
Similar to BASIC's PCOPY command, GCopy copies one page of
graphics memory to another, but returns an error flag instead of
requiring ON ERROR to trap errors. GCopy also works with the Super13
VGA mode. oops% = 0 if no error, or -1 if GCopy is not supported or
if either frompage% or topage% is too large.
Example:
frompage% = 0: topage% = 1
CALL GCopy(frompage%, topage%, oops%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GetPixel(x%, y%, value%)
object file: pixel.obj (q$graph.obj, a$rdot.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
Determines the color of the pixel located at (x%, y%).
Returns value% = -1 if (x%,y%) falls outside the active graphics
viewport.
Example:
x% = 0: y% = 0
CALL GetPixel(x%, y%, value%)
REM This will determine the color of the pixel at the upper left
REM corner of the screen.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GraphColor(attr%)
object file: q$graph.obj
Modes supported: HGraph (InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,7,8,9,10,12,13
Sets the color attribute to be used when QLIB subroutines are
used in color modes. Color attributes for 16-color modes may be
calculated with ColorAttr (See VIDEO.DOC).
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GCursor(x%, y%)
Subroutine: GUCursor(x%, y%)
object file: gcursor.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
GCursor subroutines put a text cursor on graphics screens
at the character box with upper left coordinates at x%, y%.
GCursor and GUCursor subroutines are similar to QLIB's text-mode
CursorON and UCursorON subroutines, except that GCursor waits until
a key has been pressed before returning to QuickBASIC. The key
pressed may be determined with QLIB's input subroutines, or with
QB's INKEY$ function. In HGraph, SCREEN 9, 10, or 12, GCursor
subroutines work with either normal text or QLIB's small text. To use
GCursor with text printed by BASIC, see example 2.
Example 1:
CALL HGraph
a$ = "I want a cursor at the 'I' at the start of this line"
x% = 5: y% = 3: style% = 1
CALL GPrint(a$, x%, y%, style%)
CALL GCursor(x%, y%)
Example 2:
SCREEN 3 ' uses QBHERC.COM or MSHERC.COM
CALL StdText ' make sure the BIOS data area
' has been updated
row% = 10: column% = 3
LOCATE row%, column%: PRINT a$ ' use QB to print text
x% = (column% - 1) * 9 ' this example is for a
y% = (row% - 1) * 14 ' QBHERC 9x14 character box
CALL GCursor(x%, y%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: HGraph
Subroutine: HGraph0
object files: hgraph.obj (q$herc.obj, hmode.obj)
Subroutine: HText
object files: hmode.obj (q$herc.obj)
Requires Hercules (mono or InColor)
These subroutines change modes on the Hercules graphics card,
without using QBHERC.COM. If you use HGraph to set graphics mode,
QuickBASIC video input/output functions will not work, and you must use
HText to restore text mode. QB2/QB3/QB87 users MUST use HGraph to use
Hercules graphics. HText resets QPage to 0. (See UseTPage in VIDEO.DOC)
HGraph clears the entire video buffer; HGraph0 clears only page 0.
With HGraph0, anything in graph page 1 is undisturbed. A graph may
be stored in page 1, the system can be switched back to text mode for a
while, and if text page 8 - 15 are not used, the graph may be restored
by calling HGraph0 and GCopy(1, 0, oops%).
HGraph0 can also be used if text screens are stored in pages 8 - 15.
As long as graph page 1 is not used, the text screens will not be
disturbed and can be restored with HText and TCopy.
If you are using Hercules graphics in a 2-monitor system, use HGraph0.
HGraph0 and HText will make the Monochrome monitor the default; to
use the color monitor, call ModeColor (See VIDEO.DOC).
Example:
CALL HGraph ' establishes Hercules Graphics mode
' QLIB graphics subroutines will work properly
CALL HText ' returns Hercules system to text mode
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GCenter(st$, y%, style%)
object files: gcenter.obj (q$graph.obj, gprint.obj, f8x14.obj)
GCenter prints text on a graphics screen, centered horizontally.
This subroutine calculates the correct x-coordinate, then calls
GPrint. GCenter supports all style% parameters and graphics
modes supported by GPrint.
Example:
REM I want to center a graph title at the top of the screen
y% = 0 ' top of screen
style% = 1: title$ = "Graph Title"
CALL GCenter(title$, y%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GCenterX(st$, y%, style%)
object files: gcenterx.obj (q$graph.obj, gprintx.obj, f8x14.obj)
GCenterX prints double-width text on a graphics screen, centered
horizontally. This subroutine calculates the correct x-coordinate,
then calls GPrintX. GCenterX supports all style% parameters and
graphics modes supported by GPrintX.
Example:
REM I want to center a graph title at the top of the screen
y% = 0 ' top of screen
style% = 1
title$ = "Graph Title"
CALL GCenterX(title$, y%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GLineEdit(st$, x%, y%, style%, options%, keycode%)
object files: gedit.obj (gcursor.obj, gprint.obj, lineedit.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16, Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
GLineEdit works like LineEdit (see INPUT.DOC), but is usable in
graphics modes. GLineEdit uses all LineEdit options except 8 (BIOS
display) and -32768 (alternate cursor). All LineEdit editing commands,
as well as StartEdit and LastEdit, work properly with GLineEdit.
GLineEdit also works fine with SmallText. See LineEdit for examples.
Style% 1 and -1 work best.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GLoad(filename$, oops%)
Subroutine: GSave(filename$, oops%)
object files: gsave.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,12,13
SCREEN 9,10 (requires 128k+ EGA memory)
GLoad loads a Graphics screen from a file to the screen. The file
must have been previously saved by GSave. GLoad and GSave load to or
save from the active graphics page. Filename$ must be a ASCIIZ
(zero-terminated) string. See example. If no error occurred, oops% = 0.
Oops% will be an MS-DOS error code if a file handling error occurs.
See the introductory remarks in DISK.DOC for MS-DOS error codes.
NOTE: files created by GSave eat lots of disk space:
HGraph (mono) 32,768 bytes
HGraph (InColor) 131,072 bytes
Super13 128,000 bytes
Super13a 172,800 bytes
VESA6A 240,000 bytes
XMode16 up to 240,000 bytes
SCREEN 1 16,384 bytes
SCREEN 2 16,384 bytes
SCREEN 7 32,000 bytes
SCREEN 8 64,000 bytes
SCREEN 9 112,000 bytes
SCREEN 10 56,000 bytes
SCREEN 11 38,400 bytes
SCREEN 12 153,600 bytes
SCREEN 13 64,000 bytes
Example:
filename$ = "BARGRAPH.HGC" + CHR$(0)
CALL GSave(filename$, oops%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GPage(page%, oops%)
object files: gpage.obj (q$graph.obj, q$herc.obj, egainfo.obj)
Modes supported: HGraph (mono and InColor)
Super13
SCREEN 7,8
SCREEN 9,10 (256k EGA memory)
GPage combines the function of UseGPage and ShowGPage; see UseGPage
and ShowGPage for further information.
Example:
CALL GPage(page%, oops%)
REM this is equivalent to
REM CALL UseGPage(page%, oops%)
REM CALL ShowGPage(page%, oops%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GPrint(st$, x%, y%, style%)
object files: gprint.obj (q$graph.bj, f8x14.obj)
Modes supported: HGraph (mono amd InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1 (style% 1 and -1 only)
SCREEN 2,3,7,8,9,10,11,12,13
GPrint offers much more flexibility than BASIC's PRINT command when
printing text on a graphics screen, and it's the only way to put text
on a Hercules graphics screen if MSHERC is not loaded. GPrint prints
a string of text anywhere on the screen in normal, reverse video, XOR
or "foreground only" modes. GPrint is also much faster than QB's PRINT
command in graphics modes.
The size of each character and the number of characters across the
screen depends on the current graphics mode:
mode standard character size columns
HGraph & SCREEN 3 8 x 14 90
SCREEN 1 8 x 8 40
SCREEN 2 8 x 8 80
SCREEN 7 8 x 8 40
SCREEN 8 8 x 8 80
SCREEN 9,10,11,12 8 x 14 80
SCREEN 13 8 x 8 40
Super13 8 x 14 40
Super13a 8 x 14 45
VESA6A 8 x 14 100
XMode16 8 x 14 varies
All ASCII characters may be used. x% and y% are the PIXEL locations of
the upper left corner of the first character. SmallText, below, allows
GPrint to use the smaller 8 x 8 character in Hercules, VESA6A, XMode16
and SCREEN 9-12 modes. Legal style% values are -1, 0, 1 and 2.
16-color modes also allow style% = -2, which is like style% 2 except
that the text background only is printed.
In modes with 8 x 8 characters, you must call SmallText sometime
before calling GPrint if you use characters greater than CHR$(127).
To calculate how many rows of text a graphics screen can display,
divide maximum Y by pixel rows (i.e., a Hercules screen can display
347/8 = 43 rows of text in SmallText mode).
Example:
st$ = "This is an example of text in graphics mode"
x% = 10: y% = 20: CALL GPrint(st$, x%, y%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GPrintDOWN(st$, x%, y%, style%)
Subroutine: GPrintUP(st$, x%, y%, style%)
object files: gprint.obj (q$graph.obj, f8x14.obj)
Modes supported: same as GPrint
GPrintUP rotates the string so that text reads from the bottom of
the screen to the top. This is useful for labeling the vertical axis of
a graph, among other things. GPrintDOWN reads from the top of the
screen to the bottom. These subroutines use SmallText's 8 x 8 character
box, allowing up to 43 characters from the bottom of the screen to the
top in Hercules mode. If you are going to use characters greater than
CHR$(127), you must call SmallText some time in your program before
calling GPrintDOWN/UP. However, QLIB does not need to be in SmallText
mode when you call GPrintDOWN or GPrintUP. All GPrint style% values are
valid.
Example:
DEFINT a - z
CALL HGraph
CALL SmallText ' let GPrintUP know where to find
. ' character definitions > CHR$(127)
.
.
CALL GPrintUP(text$, x%, y%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: GPrintX(st$, x%, y%, style%)
Subroutine: GPrint2X(st$, x%, y%, style%)
Subroutine: GPrintDOWNX(st$, x%, y%, style%)
Subroutine: GPrintDOWN2X(st$, x%, y%, style%)
Subroutine: GPrintUPX(st$, x%, y%, style%)
Subroutine: GPrintUP2X(st$, x%, y%, style%)
object files: gprintx.obj (q$graph.obj, f8x8.obj)
Modes supported: same as GPrint
GPrintX subroutines are similar to GPrint, GPrintUP and GPrintDOWN,
except each character in st$ is expanded to twice its normal horizontal
size before printing it on the screen; this is handy for graph headings.
GPrint2X subroutines expand each character horizontally and vertically;
All graphics modes and styles supported by GPrint work fine with these
expanded character subroutines. See GPrint for example.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: LinePattern(pattern$)
object files: fpattern.obj (drawline.obj, q$graph.obj)
LinePattern passes a string of characters of up to 8 bytes to QLIB's
DrawLine and DrawBox subroutines. The pattern of bits in pattern$ modify
lines so that they are drawn as a series of dots and/or dashes instead of
as a solid line. Lines drawn with a pattern will be slower than those
drawn without a pattern. In order to use pattern$, style% must be greater
than zero. On monochrome screens, only style% 1 and 2 are useful.
LinePattern must be called before each call to DrawLine or DrawBox if
it is to work.
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
Style% parameters have the following effects:
style% 1 = both foreground and background colors are
drawn, obliterating underlying pixels
style% 2 = foreground only replaces pre-existing pixels.
style% 3 = foreground is ORed with pre-existing pixels
style% 4 = foreground is ANDed with pre-existing pixels.
Example:
pattern$ = SPACE$(8)
CALL LinePattern(pattern$)
CALL DrawBox(x0, y0, x1, y1, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Function: MakeGVScreen
Subroutine: KillGVScreen
object files: gvscreen.obj (q$graph.obj, q$alloc.obj)
MakeGVScreen permits Hercules graphics subroutines to be directed
to virtual screens. This is similar to QLIB's text-mode VScreens.
Hercules virtual screens may be used with ANY computer, whether a
Hercules Graphics Card is installed or not. After the graph has been
created in memory it can be printed with ScreenDump or saved with GSave.
Graphics subroutines known to work with virtual screens include:
Gprint GPrintUP GPrintDOWN SmallText StdText
DrawLine DrawCircle DrawBox FillBox FillArea
CircleAspect FillPattern GetPixel SetPixel GSave
GLoad ScreenDump GetGBlock SetGBlock
Example:
REM $INCLUDE: 'qlib.bi'
gseg% = MakeGVScreen ' MakeGVScreen allocates memory for
' the graph and makes QLIB's graphics
' subroutines use that memory. gseg% = 0
' if insufficient memory is available.
CALL UseHerc ' this is nessesary only if the computer
' is in some other graphics mode
CALL DrawLine(x0%, y0%, x1%, y1%, style%)
.
.
.
CALL KillGVScreen ' release the memory and restore QLIB's
' defaults after all I'm done with the
' graph.
CALL UseDefault ' do this if you called UseHerc
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: ScreenMode(mode%)
object files: scrmode.obj (hgraph.obj, hmode.obj)
ScreenMode allows graphics or text mode to be set, bypassing
QuickBASIC's SCREEN command. If your program uses QLIB's graphics
subroutines instead of QuickBASIC's graphics commands, you can reduce
your program's size significantly by using ScreenMode instead of
SCREEN. ScreenMode also allows you to use VESA mode &H6A, which
is supported by QLIB's graphics.
The mode% parameter is the BIOS mode number for the screen mode
(except Hercules - QLIB uses the Microsoft convention of mode 8
for Hercules since no BIOS mode number exists for Hercules).
BIOS mode numbers and the equivalent QuickBASIC SCREEN numbers are:
BIOS number equipment SCREEN number
&H3 CGA, MCGA, EGA, VGA SCREEN 0 (text mode)
&H4 CGA, MCGA, EGA, VGA SCREEN 1
&H5 CGA, MCGA, EGA, VGA SCREEN 1
&H6 CGA, MCGA, EGA, VGA SCREEN 2
&H7 Monochrome, Hercules SCREEN 0 (text mode)
EGA Monochrome
&H8 Hercules, InColor SCREEN 3
(requires MSHERC.COM)
&HD EGA, VGA SCREEN 7
&HE EGA, VGA SCREEN 8
&HF EGA, VGA (monochrome) SCREEN 10 128k+ memory
&H10 EGA, VGA SCREEN 9 128k+ memory
&H11 MCGA, VGA SCREEN 11
&H12 VGA SCREEN 12
&H13 MCGA, VGA SCREEN 13
&H6A VESA VGA
NOTE: ScreenMode is NOT intended for switching between a color
monitor and a monochrome monitor. Use ModeColor and ModeMono for
monitor switching.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: SetPixel(x%, y%, style%)
object files: pixel.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
Sets the pixel at (x%, y%) according to the specified style% and
current GraphColor. Legal style% values are -1, 0, and 1. Style% 2,
3, -2 and -3 are supported in 16-color modes. Coordinates outside the
active graphics viewport are ignored.
Example:
x% = 10: y% = 10: style% = 0
CALL SetPixel(x%, y%, style%)
REM In this example, the pixel will be turned off if it had been
REM on, and will be turned on if it had been off.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: ScreenDump(oops%)
object files: scrndump.obj (q$graph.obj)
Modes supported: HGraph (mono) not yet tested with InColor
SCREEN 3
Prints the active graphics screen on a graphics printer (Epson MX,
FX, RX; IBM Graphics Printer, IBM ProPrinter, and compatibles).
ScreenDump can be stopped with the ESC key. If this occurs, oops% = 27
is returned (27 is the ASCII character code for the ESC key). If the
computer is not in Hercules graphics mode, oops% = -1. If all went
well, oops% = 0. Use PrinterReady (EQUIP.DOC) to see if the printer is
ready.
Example:
CALL ScreenDump(oops%)
oops$ = ""
IF oops% = -1 THEN oops$ = "Not Hercules mode"
IF oops% = 27 THEN oops$ = "Printing stopped"
IF LEN(oops$) THEN PRINT oops$
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: ShowGPage(gpage%, oops%)
object files: gpage.obj (q$graph.obj, egainfo.obj)
Modes supported: HGraph (mono and InColor) pages 0 and 1
(must be default mode)
SCREEN 3 pages 0 and 1
SCREEN 7 pages 0 through 7 (depends on EGA memory)
SCREEN 8 pages 0 through 3 (depends on EGA memory)
SCREEN 9 pages 0 and 1 (256k EGA memory)
SCREEN 10 pages 0 and 1 (256k EGA memory)
Super13 pages 0 and 1
ShowGPage changes the graph page visible on the screen.
This can be handy for animation or for storing one graph while another
is displayed. If gpage% is too large for the default mode, oops% = -1.
See also GPage.
Example:
CALL HGraph ' establish Hercules graphics mode
. ' HGraph calls Use64k
.
. ' display graph 0
.
gpage% = 1
CALL UseGPage(gpage%, oops%)
' now put a graph in the second page
.
.
.
CALL ShowGPage(gpage%, oops%)
' let's look at graph 1 now that it's
. ' complete
.
.
gpage% = 0
CALL GPage(gpage%, oops%) ' restore default output page
' and look at graph 0
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: ShowGraphPlane(plane%, oops)
object files: gplane.obj (q$graph.obj)
Modes supported: VESA6A, XMode16
SCREEN 7,8,12
SCREEN 9 (128k or more EGA memory)
SCREEN 10 (planes 0 and 2, 128k or more EGA memory)
EGA and VGA memory in 16-color modes is arranged in 4 parallel
"planes". The 16 colors available when all planes are visible result
from a combination of the data bits in each plane at each data address.
The planes, numbered 0, 1, 2 and 3, each control a single color. With
the default palette, plane 0 is blue, plane 1 is green, plane 2 is red
and plane 3 is "intensity". A pixel that appears bright blue in the
screen represents pixels at identical locations in the Blue and Intensity
planes. (Note that the actual colors each plane represents may change
depending on the use of QuickBASIC's COLOR and PALETTE statements).
The plane% parameters are:
plane 0 plane% = 1
plane 1 plane% = 2
plane 2 plane% = 4
plane 3 plane% = 8
Use BASIC's OR operator to show more than one plane; i.e., to
show only planes 0 and 3, plane% = 1 OR 8. To restore normal output,
plane% = 1 OR 2 OR 4 OR 8.
Example:
CALL ShowGraphPlane(plane%, oops)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: SetView(x0%, y0%, x1%, y1%)
Subroutine: GetView(x0%, y0%, x1%, y1%)
object files: view.obj (q$graph.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
Super13, Super13a
SCREEN 1,2,3,7,8,9,10,11,12,13
SetView establishes the active viewport on the active graphics
page. Most QLIB graphics subroutines limit their output to the
active viewport. GetView returns the viewport coordinates
presently active. QLIB's default viewport is the entire graphics
screen. If SetView is called with coordinates outside legal bounds
(for example, if x1% = 1000), SetView limits the coordinates to the
bounds for the active graphics mode (or to Hercules bounds if the
system is either not in graphics mode or in an unsupported mode).
This is NOT like QuickBASIC, which calls the out-of-bounds coordinate
an illegal function call. This SetView feature is handy for clearing
out old view data or for establishing the entire screen as the
viewport when the exact limits are variable or unknown (such as
with XMode16).
Example:
CALL SetView(x0%, y0%, x1%, y1%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: SmallText
Subroutine: StdText
object files: smalltxt.obj (gprint.obj, q$graph.obj, f8x8.obj)
Modes supported: HGraph (mono and InColor)
VESA6A, XMode16
SCREEN 3,9,10,12
GPrint and GLineEdit may be set to use a smaller 8 x 8 character,
which allows up to 43 rows of text in Hercules graphics mode, where
StdText (QLIB's default) results in a maximum 25 rows of text. Once
SmallText is called, GPrint and GLineEdit will print 8 x 8 text until
the 8 x 14 character is restored with StdText. 8x8 and 8x14 text
may be mixed on one screen.
Example:
CALL HGraph ' establish Hercules graphics mode
CALL SmallText ' sets GPrint to use small text
CALL GPrint(a$, x0%, y0%, style%)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: Super13
object files: super13.obj (q$graph.obj)
Requires VGA
This subroutine changes VGA cards to an undocumented 320 x 400
256-color mode. I have used this mode on PS/2 computers, and it should
be compatable with most other VGA systems. This mode has twice the
resolution of SCREEN 13, and QLIB supports 2 pages in this mode.
Example:
CALL GetCRT(crt)
IF crt = 3 THEN
CALL Super13
ELSE
PRINT "Mode Super13 not available"
END IF
.
.
.
REM all done with graphics, go back to text mode
CALL ModeColor ' 80 x 25 text mode
CALL XModeClear ' clear QLIB's internal flags
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: Super13a
object file: super13a.obj (q$graph.obj)
Requires VGA
As with Super13 above, Super13a is an undocumented 256-color
mode which I have used on PS/2 computers, and also has been used with
Paradise VGA cards. Super13a provides 360 x 480 resolution, 270% more
pixels than the standard SCREEN 13. This mode does not allow multiple
pages. See Super13 for example. Super13a is based on John Bridges'
mode set code and parameters.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: Use32k
Subroutine: Use64k
object file: q$herc.obj
Requires Hercules (mono or InColor)
Use32k masks the second 32k block of Hercules memory out of the
memory map. If the second 32k is included in the memory map, QLIB's
video routines can use all Hercules screen pages. The second 32k of
Hercules video memory conflicts with most color monitors' address space,
so Use32k should be used to mask the second 32k out of the memory map
for two-monitor systems. Use64k allows the second block. QLIB's
default is Use32k. You MUST call Use64k if you want to use graphics
page 1 with Hercules systems.
Example:
CALL GetCRT(crt%)
IF crt% >= 128 THEN CALL Use64k
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: UseFont (fseg%, fptr%, points%, bytes%)
object files: usefont.obj, f8x14.obj
Supports: all graphics modes with ymax% > 200
UseFont permits use of non-standard fonts with GPrint, GPrintX, GCenter
and GCenterX. The font you wish to use must be somewhere in memory,
either "hardwired" into your program or loaded from a disk file.
Parameters used when calling UseFont are:
fseg% = segment address of character definition data
fptr% = offset address of character definition data
points% = height of each character on screen (in pixel rows)
bytes% = byte interval from the start of one character definition
to the next
QLIB's GPrint subroutines assume that each character is 8 pixels wide.
Example:
REM $INCLUDE: 'C:\QB4\QLIB.BI'
REM I want to use the italic font supplied by Hercules with the
REM InColor Card and Graphics Card Plus. All Hercules font files
REM have a byte interval of 16, even for those fonts which are
REM less than 16 points high.
filename$ = "C:\RAMFONT\ITALICS.FNT" + CHR$(0)
fseg% = FLoad (filename$) ' load font file into far memory
fptr% = 0 ' Hercules font definitions begin
' at the start of the file
points% = 14: bytes% = 16 ' 14-point font
CALL UseFont (fseg%, fptr%, points%, bytes%)
' GPrint will now use italics font
' until SmallText or StdText is
' is called, or until UseFont is
' called with another font definition
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: UseHerc
Subroutine: UseDefault
object file: useherc.obj ($graph.obj)
UseHerc forces QLIB's graphics subroutines to use Hercules-
mode algorithms. This is handy when you want to create a virtual
graphics screen (for ScreenDump, as an example) while the computer
is displaying a graph in another graphics mode. UseDefault causes
QLIB to use the algorithms for the system's active graphics mode.
UseHerc is NOT required if the system is in Hercules mode.
Example:
CALL UseHerc
.
.
.
CALL UseDefault
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: UseGPage(gpage%, oops%)
object files: gpage.obj (q$graph.obj, q$herc.obj, egainfo.obj)
Modes supported: HGraph (mono and InColor) pages 0 and 1
SCREEN 3 pages 0 and 1
SCREEN 7 pages 0 through 7 (with 265k EGA)
SCREEN 8 pages 0 through 3 (with 265k EGA)
SCREEN 9 pages 0 and 1 (256k EGA memory)
SCREEN 10 pages 0 and 1 (256k EGA memory)
Super13 pages 0 and 1
UseGPage changes the default screen page for QLIB's graphics
subroutines. QLIB's default gpage% is 0. If multiple pages are not
available for the current mode, or gpage% is too big, oops% = -1.
Example:
CALL HGraph ' establish Hercules graphics mode
' HGraph calls Use64k
gpage% = 1
CALL UseGPage(gpage%, oops%)
' QLIB's graphics subroutines use page 1 now
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: XMode16(m%, maxX%, maxY%)
Subroutine: XMode16A(m0%, m1%, maxX%, maxY%)
object file: xmode.obj
Subroutine: XModeClear
Subroutine: ModeColor
XMode16 subroutines allow the use of many extended EGA and VGA
graphics cards at higher resolutions than IBM's products allow, in
16-color modes. Depending on the graphics card/monitor combination
in use, resolutions up to 800 pixels horizontal and 600 pixels vertical
are possible. The manual supplied with your extended EGA or VGA card
contains the information you need to put the high-resolution modes to
work. A multi-frequency monitor is generally required (see the graphics
card manual for specific requirements).
You must have the required equipment and use the correct mode number;
hardware damage may result from improper use of XMode16. I cannot be
held responsible for damage resulting from use of XMode16.
When using XMode16, the parameters required are:
m% = mode number (from graphics card manual, for 8086 register AL)
maxX% = maximum horizontal dimension
maxY% = maximum vertical dimension
If 800 horizontal pixels are available, maxX% should be 799. Similarly,
if 600 vertical pixels are possible, maxY% should be 599.
If your graphics card requires two mode parameters in the 8086's
AL and BL registers, use XMode16A instead, where
m0% = mode number for AL register
m1% = mode number for BL register
maxX% = maximum horizontal dimension
maxY% = maximum vertical dimension
Any QLIB subroutines compatible with XMode16 will work equally well
with XMode16A.
Your graphics card manual lists mode numbers, equipment requirements,
and the number of horizontal and vertical pixels corresponding to the
mode. Mode numbers are usually in hex format. Some modes and
corresponding mode numbers are listed on the next page:
Equipment mode mode number Example
Orchid ProDesigner 800x600 &H29 CALL XMode16(&H29, 799%, 599%)
STB EM/16
Genoa
Sigma X16
Everex MED EGA 640X480 &H70, &H00
(Micro Enhancer Deluxe) CALL XMode16a(&H70, &H00, 639%, 479%)
752x410 &H70, &H01
CALL XMode16a(&H70, &H01, 751%, 409%)
ATI VGA Wonder 800x600 &H54 CALL XMode16(&H54, 799%, 599%)
ATI VIP 800x560 &H53 CALL XMode16(&H53, 799%, 559%)
Paradise Plus-16 800x600 &H58 CALL XMode16(&H58, 799%, 599%)
Paradise Professional
Video 7 Fastwrite 800x600 &H62 CALL XMode16(&H62, 799%, 599%)
Video 7 VRAM
If any of this information conflicts with the specifications in your
video card's instruction manual, the manual's recommendation is a safer
bet. Note that all the above modes require a multi-frequency monitor.
When you're all done with Graphics mode, CALL ModeColor to return to
80x25 text mode, and CALL XModeClear to reset QLIB's internal XMode flags.
REM All done with graphics for now, go back to 80 x 25 text mode
CALL ModeColor
REM also clear QLIB's internal flags
CALL XModeClear
***************** QWINDOW USER-DEFINED COORDINATE SUBSYSTEM ****************
The QLIB QWindow user-defined coordinate subsystem for QLIB graphics is
intended as a replacement for BASIC's WINDOW command. The QWindow system
permits the programmer to specify custom coordinates for any QLIB graphics
mode, and changes the direction of increasing y-coordinates from the
default top-to-bottom to the more familiar bottom-to-top orientation.
QWindow subroutines are listed at the end of this file.
For each QWindow graphics subroutine, the usage and calling parameters are
identical to the primary QLIB graphics subroutine. For example,
to use QWBitBlockBytes, see the documentation for BitBlockBytes, but
call QWBitBlockBytes with QWindow coordinates.
If you have defined your own coordinates, you may still use QLIB's primary
graphics subroutines with the absolute coordinates at the beginning of
this file. If your program repeatedly calls QLIB graphics subroutines
with the same coordinates, your program will run a bit faster if you
convert QWindow coordinates to QLIB's native absolute coordinates and
use the non-QWindow subroutine. See QW2Abs.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: QW2Abs(x, y)
object file: qw2abs.obj, qwindow.obj
QW2Abs converts QWindow coordinates to QLIB's native absolute
coordinates. This is handy if you will be repeatedly calling QLIB
graphics subroutines with the same coordinates; convertng to absolute
coordinates and calling the non-QWindow subroutine will make your
program run a bit faster.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: QWindow(x0, y0, x1, y1)
object file: qwindow.obj
QWindow establishes the user-defined coordinate system. The
coordinate at (x0, y0) is the lower left corner of the working area
and the coordinate at (x1, y1) is the upper right corner of the area.
The working area can be either the entire screen or QLIB's active view
area (see QWScreen and QWView). If x0 is less than 0, the origin
of the horizontal axis will be shifted right. If y0 is less than 0,
the origin of the vertical axis will be shifted up.
Example:
DEFINT A-Z
REM my data series has a minimum y-value of -32 and a maximum
REM y-value of 181, while the x-values range from -10 to 75
CALL ScreenMode(&H10) ' EGA 640x350 mode
CALL QWScreen ' coordinates relative
' to entire screen
CALL QWindow(-10, -32, 75, 181) ' user-defined graph coordinates
CALL QWLine(0, -32, 0, 181, 1) ' draw vertical axis
CALL QWLine(-10, 0, 75, 0, 1) ' draw horizontal axis
REM put dots on the screen for a X vs. Y chart
FOR i = 0 to 100
CALL QWSetPixel(x%(i), y%(i), style%)
NEXT i
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Subroutine: QWScreen
Subroutine: QWView
object file: qwindow.obj
These subroutines allow you to define your coordinate system
relative to the entire screen (QWScreen) or relative to QLIB's active
View area.
Example:
DEFINT A-Z
REM I want to use 90% of the screen dimensions for a plot with
REM coordinates from -100 to +100
REM start with View equal to entire screen area
CALL ResetView
REM next, define the coordinate system, relative to entire screen
CALL QWindow(-100, -100, 100, 100)
CALL QWScreen
REM now get the absolute coordinates for 90% of the screen dimensions
x0% = -90: y0% = -90
x1% = 90: y0% = 90
CALL QW2Abs(x0%, y0%) ' convert first coordinate
CALL QW2Abs(x1%, y1%) ' convert second coordinate
REM use absolute coordinates to set QLIB view area
CALL SetView(x0%, y0%, x1%, y1%)
REM make QWindow coordinates relative to active view area
CALL QWView
REM ready to go!
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
QWindow subroutines, the comparable QLIB subroutine and QWindow
object files are listed below:
QWindow subroutine QLIB subroutine object file
QWLine DrawLine qwline.obj
QWBox DrawBox qwline.obj
QWFillBox FillBox qwline.obj
QWFill FillArea qwfill.obj
QWGCenter GCenter qwcenter.obj
QWGCenterX GCenterX qwcentrx.obj
QWCircle DrawCircle qwcircle.obj
QWGLineEdit GLineEdit qwgedit.obj
QWGPrint GPrint qwgprint.obj
QWGPrintUP GPrintUP qwgprint.obj
QWGPrintDOWN GPrintDOWN qwgprint.obj
QWBitBlockBytes BitBlockBytes qwblock.obj
QWBitBlockSave BitBlockSave qwblock.obj
QWBitBlockRestore BitBlockRestore qwblock.obj
QWBitPlaneBytes BitPlaneBytes qwplane.obj
QWBitPlaneSave BitPlaneSave qwplane.obj
QWBitPlaneRestore BitPlaneRestore qwplane.obj
QWGetPixel GetPixel qwpixel.obj
QWSetPixel SetPixel qwpixel.obj
QWGPrintX GPrintX qwprintx.obj
QWGPrint2X GPrint2X qwprintx.obj
QWGPrintUPX GPrintUPX qwprintx.obj
QWGPrintDOWNX GPrintDOWNX qwprintx.obj
QWGPrintUP2X GPrintUP2X qwprintx.obj
QWGPrintDOWN2X GPrintDOWN2X qwprintx.obj
QWGCursor GCursor qwcursor.obj
QWGUCursor GUCursor qwcursor.obj
In all cases, QWindow subroutines are called from your BASIC program
with the same parameters, except that screen coordinates are QWindow
coordinates instead of QLIB's native absolute pixel locations.